package com.century.sjt.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.allinpay.appayassistex.APPayAssistEx;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.century.sjt.R;
import com.century.sjt.adapter.ChoosePayAdapter;
import com.century.sjt.entity.BankCard;
import com.century.sjt.util.Constant;
import com.century.sjt.util.SrcUtil;
import com.century.sjt.util.TipUtil;
import com.century.sjt.widget.TitleBar.SjtTitleBar;
import com.century.sjt.window.PayPopupWindow;
import com.century.sjt.window.PayPopupWindowS;
import com.century.sjt.window.PayPwdWindow;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author:周玲波
 * @Description:充值
 * @date : 2016/8/20 15:04
 */
public class WalletRechareActivity extends BaseActivity {
    private Button Btn_Rechare;
    SjtTitleBar wallet_rechare_title;
    private TextView tvPayS;
    private LinearLayout payTypeLayout;

    private final BankCard payBack = new BankCard();
    ;
    private ChoosePayAdapter adapter;
    private List<BankCard> mDatalist;
    private Handler mHandler;
    private String cardNo = "";
    private ImageView imgBankLogo;
    private EditText etAmount;
    private String orderNo = "";
    private String BankcardType;
    PayPopupWindow payWindow;

    private String toPayType = "10";
    PayPwdWindow popupWindow;

    private List<BankCard> mCardList = new ArrayList<>();
    private List<BankCard> mMTList = new ArrayList<>();


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sjt_wallet_recharge_activity);
        initView();
        initEvent();
    }


    @Override
    protected void initView() {
        Btn_Rechare = (Button) findViewById(R.id.btn_rechare);
        wallet_rechare_title = (SjtTitleBar) findViewById(R.id.wallet_recharge_title);
        etAmount = (EditText) findViewById(R.id.et_amount);
        payTypeLayout = (LinearLayout) findViewById(R.id.c_layout_pay_type);
        tvPayS = (TextView) findViewById(R.id.c_bankname);
        imgBankLogo = (ImageView) findViewById(R.id.c_yh_image);
        mDatalist = new ArrayList<>();

    }

    @Override
    protected void initEvent() {
        //       标题栏
        wallet_rechare_title.setTitle(getResources().getString(R.string.btn_recharge));
        wallet_rechare_title.setLeftIconResource(getResources().getString(R.string.icon_return));
        wallet_rechare_title.setLeftLayoutClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        payWindow = new PayPopupWindow(WalletRechareActivity.this, "1","3");
        popupWindow = new PayPwdWindow(WalletRechareActivity.this);
//        payTypeLayout.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                String tAmount = etAmount.getText().toString();
//                InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
//                imm.hideSoftInputFromWindow(etAmount.getWindowToken(), 0);
//                GetPayType("0", "", tAmount);
//
//            }
//        });

        payWindow.setPayWindowListItemClickListener(new PayPopupWindow.PayWindowListItemClickListener() {
            @Override
            public void onItemClick(BankCard message) {
                String CardName = message.getCardName();
                tvPayS.setText(CardName);
                String[] bankCodes = getResources().getStringArray(R.array.bankcode);
                TypedArray ar = getResources().obtainTypedArray(R.array.bankicon);
                for (int j = 0; j < bankCodes.length; j++) {

                    if (bankCodes[j].toString().equals(message.getBankCode())) {
                        imgBankLogo.setImageResource(ar.getResourceId(j, 0));
                        break;
                    }
                }
                if (getResources().getString(R.string.text_blance_pay).equals(CardName)) {
//                    tvBalance.setText(message.getBankCardNo());
                } else {
//                    tvBalance.setText("");
                    cardNo = message.getBankCardNo();

                }

            }

            @Override
            public void onPayTypeClick(String Type) {
                toPayType = Type;
                setPay();
            }
        });

        popupWindow.setPayPwdWindowListItemClickListener(new PayPwdWindow.PayPwdWindowListItemClickListener() {
            @Override
            public void onPassWord(String pwd) {
                queryRecharData(etAmount.getText().toString(), cardNo, "1", pwd);
//                Log.e("pwd",pwd);
            }

            @Override
            public boolean onOpenWindow(boolean isdo) {
                return false;
            }

            @Override
            public boolean onCloseWindow(boolean isdo) {
                if (isdo) {
                    Log.e("do", "doing");
                }
                return false;
            }
        });
        Btn_Rechare.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (etAmount.getText().equals("") || etAmount.getText() == null) {
                    TipUtil.showToast(getResources().getString(R.string.error_please_input_amount), WalletRechareActivity.this, 1);
                }else {
                    String tAmount = etAmount.getText().toString();
                    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(etAmount.getWindowToken(), 0);
                    GetPayType("0", "", tAmount);
                }
//                else if(tvPayS.getText().toString().equals(getResources().getString(R.string.text_p_choose_pay_type))){
//                    TipUtil.showToast(getResources().getString(R.string.text_p_choose_pay_type), WalletRechareActivity.this, 1);
//                }else{
//                    setPay();
//                }


            }
        });

        etAmount.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                 /*判断是否是“GO”键*/
                if (actionId == EditorInfo.IME_ACTION_NEXT) {
                    /*隐藏软键盘*/
                    InputMethodManager imm = (InputMethodManager) v
                            .getContext().getSystemService(
                                    Context.INPUT_METHOD_SERVICE);
//                    if (imm.isActive()) {
//                        imm.hideSoftInputFromWindow(
//                                v.getApplicationWindowToken(), 0);
//                    }

//                    edittext.setText("success");
//                    webview.loadUrl(URL);
                    setPay();
                    return true;
                }
                return false;
            }
        });


        etAmount.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before,
                                      int count) {
                if (s.toString().contains(".")) {
                    if (s.length() - 1 - s.toString().indexOf(".") > 2) {
                        s = s.toString().subSequence(0,
                                s.toString().indexOf(".") + 3);
                        etAmount.setText(s);
                        etAmount.setSelection(s.length());
                    }
                }
                if (s.toString().trim().substring(0).equals(".")) {
                    s = "0" + s;
                    etAmount.setText(s);
                    etAmount.setSelection(2);
                }

                if (s.toString().startsWith("0")
                        && s.toString().trim().length() > 1) {
                    if (!s.toString().substring(1, 2).equals(".")) {
                        etAmount.setText(s.subSequence(0, 1));
                        etAmount.setSelection(1);
                        return;
                    }
                }
            }

            @Override
            public void afterTextChanged(Editable editable) {
                if (SrcUtil.toAcoument(etAmount.getText().toString())) {
                    TipUtil.showToast(getResources().getString(R.string.error_amount_greater_million), WalletRechareActivity.this, 1);
                }
            }
        });

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (APPayAssistEx.REQUESTCODE == requestCode) {
            if (null != data) {
                String payRes = null;
                String payAmount = null;
                String payTime = null;
                String payOrderId = null;
                try {
                    JSONObject resultJson = new JSONObject(data.getExtras().getString("result"));
                    payRes = resultJson.getString(APPayAssistEx.KEY_PAY_RES);
                    payAmount = resultJson.getString("payAmount");
                    payTime = resultJson.getString("payTime");
                    payOrderId = resultJson.getString("payOrderId");
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                if (null != payRes && payRes.equals(APPayAssistEx.RES_SUCCESS)) {
//                    showAppayRes("充值成功！");
                    Intent intent = new Intent();
                    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    intent.setClass(WalletRechareActivity.this, WalletActivity.class);
                    startActivity(intent);
                } else {
//                    showAppayRes("充值失败失败！");
                    TipUtil.showToast(getResources().getString(R.string.recharg_fail), WalletRechareActivity.this, 1);
                    depositCancel(orderNo);
                }
//                Log.d("payResult", "payRes: " + payRes + "  payAmount: " + payAmount + "  payTime: " + payTime + "  payOrderId: " + payOrderId);
            }
        }
        super.onActivityResult(requestCode, resultCode, data);
    }

    public void setPay() {
        if (etAmount.getText().equals("") || etAmount.getText() == null) {
            TipUtil.showToast(getResources().getString(R.string.enter_amount), WalletRechareActivity.this, 1);
        }
//        else if (BankcardType.equals(Constant.CREDIT_CARD)){
//            TipUtil.showToast(getResources().getString(R.string.error_nonsupport_credit_card), WalletRechareActivity.this, 1);
//        }
        else {
            String amount = etAmount.getText().toString();
            if (SrcUtil.toAcoument(etAmount.getText().toString())) {
                TipUtil.showToast(getResources().getString(R.string.error_amount_greater_million), WalletRechareActivity.this, 1);
            } else {
                switch (toPayType) {
//
                    case "0"://余额支付
                        break;
                    case "1"://快捷支付
                        popupWindow.showAtLocation(findViewById(R.id.paymacth), Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
                        break;
                    case "2"://银行卡支付
                        queryRecharData(etAmount.getText().toString(), cardNo, "2", "");
                        break;
                    case "3"://其它银行卡支付
                        break;
                    default:
                        TipUtil.showToast(getResources().getString(R.string.text_p_choose_pay_type), WalletRechareActivity.this, 1);
                        break;
//                                TipUtil.showToast("粗错啦！", getActivity(), 1);
                }


            }

        }
    }

    public void showAppayRes() {
        //询问是否取消
        AlertDialog.Builder builder = new AlertDialog.Builder(WalletRechareActivity.this);
        builder.setTitle(getResources().getString(R.string.text_prompt));
        builder.setMessage(getResources().getString(R.string.error_noting_binding_bankcard));
        builder.setPositiveButton(getResources().getString(R.string.btn_yes), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                Intent intent = new Intent();
                Bundle bundle = new Bundle();
                bundle.putString("type", "1");
                intent.putExtras(bundle);
                intent.setClass(WalletRechareActivity.this, AddBankActivity.class);
                startActivity(intent);
            }
        });
        builder.setNegativeButton(getResources().getString(R.string.btn_no), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        builder.setCancelable(false);
        builder.create().show();
    }

    /**
     * 获取充值订单
     */

    private void queryRecharData(final String amount, final String BankCard, final String type, final String pwd) {
        //显示Progress Dialog
        TipUtil.openProgressDialog(Constant.APPLICATION_NAME, getResources().getString(R.string.error_please_waitting), WalletRechareActivity.this);
        StringRequest stringRequest = new StringRequest(Request.Method.POST, Constant.QueryRechareHost, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                try {
                    TipUtil.closeProgressDialog();
                    TipUtil.log("接口返回成功", response.toString(), 1);
                    JSONTokener jsonParser = new JSONTokener(response);
                    JSONObject res = (JSONObject) jsonParser.nextValue();
                    String code = res.getString("code");
                    String message = res.getString("message");
                    if (code.equals("200")) {//成功

                        JSONObject Data = res.getJSONObject("data");
//                        Log.e("d",Data.toString());
//                        Log.e("text", Data.getString("issuerId") + "&" + Data.getString("tradeNature"));
                        String issuerId = Data.getString("issuerId");
                        String tradeNature = Data.getString("tradeNature");
                        String signType = Data.getString("signType");
                        String orderCurrency = Data.getString("orderCurrency");
                        String version = Data.getString("version");
                        String cardNo = Data.getString("cardNo");
                        String receiveUrl = Data.getString("receiveUrl");
                        String inputCharset = Data.getString("inputCharset");
                        orderNo = Data.getString("orderNo");
                        String ext1 = Data.getString("ext1");
                        String orderAmount = Data.getString("orderAmount");
                        String signMsg = Data.getString("signMsg");
                        String payType = Data.getString("payType");
                        String merchantId = Data.getString("merchantId");
                        String language = Data.getString("language");
                        String orderDatetime = Data.getString("orderDatetime");
                        String productName = Data.getString("productName");
                        if ("1".equals(type)) {
                            TipUtil.showToast(getResources().getString(R.string.recharg_success), WalletRechareActivity.this, 1);
                            finish();
                        } else if (!(issuerId == null || issuerId.equals(""))) {
                            if (!(tradeNature == null || tradeNature.equals(""))) {
                                JSONObject paaParams = new JSONObject();
                                try {
                                    paaParams.put("inputCharset", inputCharset);
                                    paaParams.put("receiveUrl", receiveUrl);
                                    paaParams.put("version", version);
                                    paaParams.put("signType", signType);
                                    paaParams.put("merchantId", merchantId);
                                    paaParams.put("orderNo", orderNo);
                                    paaParams.put("orderAmount", orderAmount);
                                    paaParams.put("orderCurrency", orderCurrency);
                                    paaParams.put("orderDatetime", orderDatetime);
                                    paaParams.put("productName", productName);
//                                    paaParams.put("ext1", ext1);
                                    paaParams.put("payType", payType);
//                        paaParams.put("issuerId", "visa");
//                        paaParams.put("tradeNature", "GOODS");
                                    paaParams.put("language", language);
//                                    paaParams.put("cardNo",cardNo);
                                    if (!(BankCard.equals("") || BankCard.length() < 14)) {
                                        paaParams.put("cardNo", BankCard);
                                    } else {
                                        paaParams.put("cardNo", cardNo);
                                    }
                                    paaParams.put("signMsg", signMsg);
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                APPayAssistEx.startPay(WalletRechareActivity.this, paaParams.toString(), Constant.PAYKEY);
                            }
                        } else {
                            APPayAssistEx.startPay(WalletRechareActivity.this, Data.toString(), Constant.PAYKEY);

                        }
                    } else {//失败
                        TipUtil.showToast(message, WalletRechareActivity.this, 1);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                    TipUtil.showToast(getResources().getString(R.string.error_service), WalletRechareActivity.this, 1);
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                TipUtil.showToast(getResources().getString(R.string.error_network), WalletRechareActivity.this, 1);
                TipUtil.closeProgressDialog();
            }
        }) {
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
                Map<String, String> map = new HashMap<String, String>();
                SharedPreferences mainSharedPreferences = getSharedPreferences(Constant.TAG, Activity.MODE_PRIVATE);
                String userId = mainSharedPreferences.getString("userId", "");
                map.put("loginId", userId);
                map.put("amount", amount);
                map.put("bankCardNo", BankCard);
                if ("1".equals(type)) {
                    map.put("cashPwd", pwd);
                }
                map.put("payMethod", type);
                return map;
            }

            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                SharedPreferences mainSharedPreferences = getSharedPreferences(Constant.TAG, Activity.MODE_PRIVATE);
                String cookie = mainSharedPreferences.getString("cookie", "");
                String rememberMeValue = mainSharedPreferences.getString("rememberMe", "");
                HashMap localHashMap = new HashMap();
                String cookieValue = cookie + ";" + rememberMeValue;
                localHashMap.put("Cookie", cookieValue);
                return localHashMap;
            }
        };
        stringRequest.setRetryPolicy(new DefaultRetryPolicy(30000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

        mQueue.add(stringRequest);
    }

    /**
     * 充值失败 取消订单
     */

    private void depositCancel(final String orderNo) {
        //显示Progress Dialog
        StringRequest stringRequest = new StringRequest(Request.Method.POST, Constant.GetDepositCancel, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                try {
                    TipUtil.closeProgressDialog();
                    TipUtil.log("接口返回成功", response.toString(), 1);
                    JSONTokener jsonParser = new JSONTokener(response);
                    JSONObject res = (JSONObject) jsonParser.nextValue();
                    String code = res.getString("code");
                    String message = res.getString("message");
                    if (code.equals("200")) {//成功
                        Log.e("depositCancel", "订单取消成功");
//                        Log.e("text", Data.getString("issuerId") + "&" + Data.getString("tradeNature"));


                    } else {//失败
//                        TipUtil.showToast(message, WalletRechareActivity.this, 1);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
//                    TipUtil.showToast(getResources().getString(R.string.error_service), WalletRechareActivity.this, 1);
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
//                TipUtil.showToast(getResources().getString(R.string.error_network), WalletRechareActivity.this, 1);
//                TipUtil.closeProgressDialog();
            }
        }) {
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
                Map<String, String> map = new HashMap<String, String>();
                SharedPreferences mainSharedPreferences = getSharedPreferences(Constant.TAG, Activity.MODE_PRIVATE);
                String userId = mainSharedPreferences.getString("userId", "");
                map.put("loginId", userId);
                map.put("orderNo", orderNo);
                return map;
            }

            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                SharedPreferences mainSharedPreferences = getSharedPreferences(Constant.TAG, Activity.MODE_PRIVATE);
                String cookie = mainSharedPreferences.getString("cookie", "");
                String rememberMeValue = mainSharedPreferences.getString("rememberMe", "");
                HashMap localHashMap = new HashMap();
                String cookieValue = cookie + ";" + rememberMeValue;
                localHashMap.put("Cookie", cookieValue);
                return localHashMap;
            }
        };
        mQueue.add(stringRequest);
    }

    @Override
    public void onResume() {
        super.onResume();

    }

    /**
     * 获取支付方式
     */
    private void GetPayType(final String Type, final String MerchantId, final String Amount) {
        StringRequest stringRequest = new StringRequest(Request.Method.POST, Constant.GetPayMethodInfo, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                try {

                    TipUtil.log("接口成功返回", response.toString(), 1);
                    JSONTokener jsonParser = new JSONTokener(response);
                    JSONObject res = (JSONObject) jsonParser.nextValue();
                    String code = res.getString("code");
                    String message = res.getString("message");
                    JSONObject aData = res.getJSONObject("data");
                    String balance = aData.getString("balance");
//                    tv_Balance.setText(balance);
                    if (code.equals("200")) {//成功
                        mCardList.clear();
                        mMTList.clear();
                        JSONArray cardList = aData.getJSONArray("cardList");
                        JSONArray MTList = aData.getJSONArray("MTList");
                        for (int i = 0; i < cardList.length(); i++) {
                            JSONObject item = (JSONObject) cardList.get(i);
                            BankCard bankCard = new BankCard();
                            bankCard.setPhone(item.getString("phone"));
                            bankCard.setCardName(item.getString("cardName"));
                            bankCard.setBankCardNo(item.getString("bankCardNo"));
                            bankCard.setBankCode(item.getString("bankCode"));
                            bankCard.setCardType(item.getString("accountType"));
                            bankCard.setRemarks(item.getString("remarks"));
                            bankCard.setAvailable(item.getString("available"));
                            bankCard.setLimit(item.getString("limit"));
                            mCardList.add(bankCard);
                        }
                        for (int i = 0; i < MTList.length(); i++) {
                            JSONObject item = (JSONObject) MTList.get(i);
                            BankCard bankCard = new BankCard();
                            bankCard.setPhone(item.getString("phone"));
                            bankCard.setCardName(item.getString("cardName"));
                            bankCard.setBankCardNo(item.getString("bankCardNo"));
                            bankCard.setBankCode(item.getString("bankCode"));
                            bankCard.setCardType(item.getString("accountType"));
                            bankCard.setRemarks(item.getString("remarks"));
                            bankCard.setAvailable(item.getString("available"));
                            bankCard.setLimit(item.getString("limit"));
                            mMTList.add(bankCard);
                        }

                        if (mCardList.size() == 0) {
                            showAppayRes();
                        } else {
                            payWindow.setAmount(etAmount.getText().toString());
                            payWindow.setmCardList(mCardList);
                            payWindow.setmMTList(mMTList);
                            payWindow.setBalance(balance);
                            //显示窗口
                            //设置layout在PopupWindow中显示的位置
                            payWindow.showAtLocation(findViewById(R.id.paymacth), Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);

                        }

                    } else {//失败
                        TipUtil.showToast(message, WalletRechareActivity.this, 1);
                    }
                } catch (JSONException ex) {
                    ex.printStackTrace();
                    TipUtil.showToast(getResources().getString(R.string.error_service), WalletRechareActivity.this, 1);
                }

                TipUtil.closeProgressDialog();
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                TipUtil.showToast(getResources().getString(R.string.error_network), WalletRechareActivity.this, 1);
                TipUtil.closeProgressDialog();
            }
        }) {
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
                Map<String, String> map = new HashMap<String, String>();
                SharedPreferences mainSharedPreferences = getSharedPreferences(Constant.TAG, Activity.MODE_PRIVATE);
                String userId = mainSharedPreferences.getString("userId", "");
                map.put("loginId", userId);
                map.put("amount", Amount);
                map.put("type", Type);
                return map;
            }

            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                SharedPreferences mainSharedPreferences = getSharedPreferences(Constant.TAG, Activity.MODE_PRIVATE);
                String cookie = mainSharedPreferences.getString("cookie", "");
                String rememberMeValue = mainSharedPreferences.getString("rememberMe", "");
                HashMap localHashMap = new HashMap();
                String cookieValue = cookie + ";" + rememberMeValue;
                localHashMap.put("Cookie", cookieValue);
                return localHashMap;
            }
        };
        mQueue.add(stringRequest);


    }


    @Override
    protected void initData() {

    }
}
